package view;

import java.util.ArrayList;

import game.KnightsTourGame;
import chess.TestKnightsTourPlayer;
import chess.Tile;

/**
 * This class is the testing view of the knights tour. It will handle all the tile selection
 * process.
 * @author Caleb Chan
 * <pre>
 * - Created February 20, 2010
 * </pre>
 */
public class KnightsTourTestView extends TestView {
	private TestKnightsTourPlayer testPlayer;
	private ArrayList<Tile> mTiles;
	private KnightsTourGame game;
	
	/**
	 * Creates an object of the knights tour testing view
	 * @param game Takes a game object
	 * <pre>
	 * - Created February 20, 2010
	 * </pre>
	 */
	public KnightsTourTestView(KnightsTourGame game){
		this.game = game;
		testPlayer = new TestKnightsTourPlayer("Knights Tour Test",this.game, "White");
		mTiles = new ArrayList<Tile>();
	}
	@Override
	/**
	 * This method will take a list of moves but as a testing method will not display the 
	 * possible moves
	 * @param mTiles A list of possible moves
	 * <pre>
	 * - Created February 20, 2010
	 * </pre>
	 */
	public void showPossibleMoves(ArrayList<Tile> mTiles,Tile curTile){
		this.mTiles = mTiles;
	}
	/**
	 * This method will select the moves for the knight. If there are no possible moves,
	 * it will set the knight at tile (0 , 7)
	 * @return Returns the selected tile
	 * <pre>
	 * - Created February 20, 2010
	 * </pre>
	 */
	@Override
	public Tile chooseTile(){
		
		Tile t = testPlayer.nextMove(mTiles);
		if (t != null){
			testPlayer.increaseMoves();
		}
		return (t == null)?game.getBoard().getTile(0, 7):t;
	}
	/**
	 * This method will return the test player object
	 * @return Returns and object of type TestKnightTourPlayer
	 * <pre>
	 * - Created February 20, 2010
	 * </pre>
	 */
	public TestKnightsTourPlayer getPlayer(){
		return testPlayer;
	}
	@Override
	public void showPossibleMoves(ArrayList<Tile> mTiles,
			ArrayList<Tile> aTiles, Tile curTile) {
		
	}
}
